<template>
  <div class="parent">
    <h1>首页头部</h1>
    <div class="login_parent">
      <div>
        <span>用户名</span>
        <input v-model="userName" placeholder="请输入用户名" />
      </div>
      <div>
        <span>密码</span>
        <input v-model="password" placeholder="请输入密码" />
      </div>
      <div>
        <button class="button1" v-on:click="login">登陆</button>
        <button class="button2">注册</button>
      </div>
    </div>
  </div>
</template>
<script>
export default {
  name: 'login',
  data () {
    return {
      userName: '',
      password: ''
    }
  },
  methods: {
    login () {
      let userName = this.userName
      let password = this.password
      let axios = require('axios')
      axios
        .get ('http://localhost:9090/login', {
          params: {
            userName : userName,
            password : password
          }
        })
        .then (function (response) {
          console.log (response)
        })
        .catch (function (error) {
          console.log(error)
        })
        .then (function () {
          // always executed
        })
    },

    register(){
    

    }
  }
}
</script>

<!-- Add "scoped" attribute to limit CSS to this component only -->
<style lang="less" scoped>
.parent {
  display: flex;
  flex-direction: column;
  width: 100%;
  justify-content: center;
  align-items: center;
  h1 {
    text-align: center;
    padding-top: 30px;
    background: #00d8a0;
    height: 100px;
    width: 100%;
  }
  .login_parent {
    margin-top: 200;
    width: 100%;
    flex-direction: column;
    align-items: center;
    div {
      display: flex;
      flex-direction: row;
      width: 100%;
      height: 50px;
      align-items: center;
      justify-content: center;
      span {
        font-size: 15px;
        width: 50px;
        text-align: right;
        color: #000000;
        margin-left: 30px;
      }
      input {
        margin-left: 20px;
        width: 200px;
        height: 25px;
        border: 1px #00d8a0;
        border-style: solid;
        border-radius: 4px;
      }
      .button1 {
        width: 80px;
        height: 40px;
        border-radius: 4px;
        background: #ffffff;
        border: 1px #00d8a0;
        border-style: solid;
      }
      .button2 {
        width: 80px;
        margin-left: 50px;
        height: 40px;
        border-radius: 4px;
        background: #ffffff;
        border: 1px #00d8a0;
        border-style: solid;
      }
    }
  }
}
</style>
